I am trying to create a combo box, with pull-down items, whereby each entry is a hyperlink to a specified file. Can this be done using only html and does anyone know how to do it? If not, should I be tackling this in a different way?
How to add hyperlink to the Combobox elements
You Mean like a dropdown menu which links to a file?
That's like this:
The HTML form:
And add the following JavaScript function:
Or do you mean something else?
~Gushe
That's like this:
The HTML form:
| Code: |
|
<form> <select id="menu" onchange="go()"> <option>Choose File</option> <option value="Link to file 1">File 1</option> <option value="Link to file 2">File 2</option> <option value="Link to file 3">File 3</option> </select> </form |
And add the following JavaScript function:
| Code: |
|
<script type="text/javascript"> function go() { window.location=document.getElementById("menu").value } </script> |
Or do you mean something else?
~Gushe
| Gushe wrote: | ||||
| You Mean like a dropdown menu which links to a file? That's like this: The HTML form:
And add the following JavaScript function:
Or do you mean something else? ~Gushe |
Thanks man.Thats exactly what i mean.I donot have any idea of java script.
One more small help please if possible--
I want to give a prompt to the user to enter the password when he tries to open the html file.
After successful entry of the password, the user should be able to see the file else he will again be directed to the password prompt.The password is hardcoded in the script.is it possible with javascript? Please help. Thanks in advance.I am using the following code but it is showing the page in the background.How to prevent it?
| Code: |
|
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> function check() { var x=0; do { var name = prompt("Enter the password for normal document", "Type your password for normal document"); if (name == "admin") { alert("Hi " + name + "\nSuccessful Login"); x=0; } else { alert("wrong password, Please try again."); x=1; } }while(x>0) } </script> </head> <body bgcolor="#A5BDD8" onload="check()" > |
Ok; I'm only learning JS too
But I think I Eventually know something
1. Make a new white internet page where there is nothing special to see and add the following script there:
2. Do so; that the link that normally should redirect you users to the file page; links your users to the blanc page
3. Where I put "Page Link Here" in the code; add the link of the file page
How It works:
1. When a user want's to go to the file page; They get a white page with your password promt; If they enter the right password they will be redirected to the file page, if not, they will have to enter the password again
Simple; but efficient.. (I think it works, couldn't test it
)
With the password hardcoding I can not help you, I'm sorry for that
I'm only a fourteen year old, silly boy who is learning some scripting
Greetz,
~Gushe
1. Make a new white internet page where there is nothing special to see and add the following script there:
| Code: |
|
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> function check() { var x=1; while (x>0) { var name = prompt("Enter the password for normal document:", ""); if (name == "admin") { alert("Hi " + name + "\nSuccessful Login"); window.location="Page Link Here" x=0; } else { alert("wrong password, Please try again."); x=1; } } } </script> </head> <body bgcolor="#A5BDD8" onload="check()" > |
2. Do so; that the link that normally should redirect you users to the file page; links your users to the blanc page
3. Where I put "Page Link Here" in the code; add the link of the file page
How It works:
1. When a user want's to go to the file page; They get a white page with your password promt; If they enter the right password they will be redirected to the file page, if not, they will have to enter the password again
Simple; but efficient.. (I think it works, couldn't test it
With the password hardcoding I can not help you, I'm sorry for that
Greetz,
~Gushe
Great help dude.
Glad I could help
~Gushe
~Gushe
Gr8 help dude.But the password is visible to everyone when typed.Can't it be substituted with * symbols like our normal password field?
