simple pop up external .js file in my html, help ! asap please!?

Archived in the category: html pop up
Posted by Kristen Meyers on 29 Jan 09 -

hey guys,

im making a website in dreamweaver. i need a pop up button, that when u press it, it pops up with the lyrics of a song :) also (i dont want it to open a window, just pop up screen thing)

ok, i know its easy to just embed this in my html, but i need to do this in an external .js file.

so, what i have is lyrics.js, and in lyrics.js i have:

function popup() {
alert (”all the lyrics of the song”)
}

then in my html, under the i have

and then where i want it (under ) i have

now wheni save everything and load it, and click the button, nothing comes up! :( is it coz the lyrics are too long and have charactors like /”() in them? how come its not working?

thanks

If yopu don’t already have it, get a copy of Firefox and install the “Web Developer Toolbar”, which shows you exactly what problems arise in your JavaScript (both errors and warnings).

Make sure to escape all single quotes in the string in JavaScript with a backslash:

var lyrics = ‘It\’s an escape character’;

Same goes for backslashes - to make a \ appear, type \\ in a string.

powered by Yahoo Answers

One comment for “simple pop up external .js file in my html, help ! asap please!?”

1
Mehdi

If yopu don’t already have it, get a copy of Firefox and install the “Web Developer Toolbar”, which shows you exactly what problems arise in your JavaScript (both errors and warnings).

Make sure to escape all single quotes in the string in JavaScript with a backslash:

var lyrics = ‘It\’s an escape character’;

Same goes for backslashes - to make a \ appear, type \\ in a string.
References :

January 29th, 2009 at 7:22 am

Laeave a Reply