English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Ok basically this is what I want to happen. A user select a song they want to play from the homepage. That causes a popupwindow to open displaying my songs page. Depending on what song they selected a variable will be sent to the songs.html file that tells it what song to do on the onload event.

So how can I pass a variable to another html file?

2007-12-02 02:45:57 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

sending a parameter is easy. You control it so there are 2 ways of doing it
1)
song.html?songtitle

2)
song.html?title=songtitle

The easiest one is option 1.
To retrieve the value in JavaScript use
var stringValue = window.location.search;

2007-12-02 03:10:41 · answer #1 · answered by AnalProgrammer 7 · 0 0

When the user selects a song title, is this simply an anchor tag which launches your second window. If this is the case, when your generating the anchor tags, add onto the end of the name of the new html page a parameter, so you'd have something like /playsong.html?songid=1000. This 'songid' would be something that you could use to identify the song they want playing, perhaps some sort of key field in your database.
The reason I'd use an ID as opposed to the song title is that some song titles contain all sorts of odd characters and spacing, which aren't recommended to be passed as part of a URL and some systems may even block them! At least with an ID you have a consistent variable that can be used, which you can query from the URL and then use to lookup the song on your database.

2007-12-02 21:19:01 · answer #2 · answered by nigel r 3 · 0 0

except utilizing isset() to work out no matter if you've some thing in $_POST['emailaddress'] (and that i assuming you're sending a placed as a lot as this document), it may paintings. attempt debugging - use Firebug and FirePHP, to work out the fee you're transforming into from $_POST['emailaddress'].

2016-10-25 07:39:18 · answer #3 · answered by desmangles 4 · 0 0

fedest.com, questions and answers