PDA

View Full Version : Javascript Help! How to put this statement


d1srupt3r
05-24-2008, 11:32 AM
I have a problem on javascript. Here's the script:
<script type="text/javascript">
function addfav()
{
if (document.all)
{
window.external.AddFavorite
("http://www.defineitfast.com","DefineItFast.com")
}
}
</script>

<A HREF="javascript:addfav()">Add To Favorites</A>


Is it possible to put this line in the red texts in the above code?
javascript:Wrd=document.selection.createRange().te xt;if(!Wrd){void(Wrd=prompt('No Word Selected, Please Type One In',''))}if(Wrd)location.href='http://www.DefineItFast.com/browse/'+escape(Wrd)+'.html&new=1'

I need this because a lot of people were not able to drag the bookmarklet in my website(users who are using IE) and I guess this is the solution, adding it in the Favorites. Thank you for helping! :)

d1srupt3r
05-25-2008, 02:36 PM
Any help please? :)

dyeprey
05-25-2008, 04:24 PM
document.write("Please Bookmark Us") :p

d1srupt3r
05-25-2008, 04:29 PM
document.write("Please Bookmark Us") :p

Sorry, I'm not that familiar with javascript, how should I use the statement you gave?
I mean how can I put the 2 code in the first code's red texts? Or is there another way around?

Quantumstate
05-26-2008, 08:51 AM
They code there for bookmarking played up in my version of IE7. One way that I found worked was to have a link with the href as
javascript:Wrd=document.selection.createRange().te xt;if(!Wrd){void(Wrd=prompt('No Word Selected, Please Type One In',''))}if(Wrd)location.href='http://www.DefineItFast.com/browse/'+escape(Wrd)+'.html&new=1'
and then the user can right click the link and add to bookmarks. I am not sure about why the top script didn't work, it may have just been my IE7 playing up.

Just to let you know, dyeprey was joking, all that code does is write the words Please bookmark us on the webpage.

d1srupt3r
05-28-2008, 05:30 AM
thanks quantum for the tip!:)
lol, dyeprey took advantage my ignorance in java. huhu..

mtawolf
06-28-2008, 04:03 AM
<!-- ONE STEP TO INSTALL BOOKMARK US:

1. Copy the coding into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the BODY of your HTML document -->

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

var url="http://www.javascriptsource.com";
var title="The JavaScript Source";

document.write('<A HREF="javascript:window.ext');
document.write('ernal.AddFavorite(url,title);" ');
document.write('onMouseOver=" window.status=');
document.write("'Add our site to your favorites!'; return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('">Add our site to your favorites!</a>');
}
else {
var msg = "Don't forget to bookmark us!";
if(navigator.appName == "Netscape") msg += " (CTRL-D)";
document.write(msg);
}

// End -->
</script>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 0.91 KB -->

this is what i found