The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
Can anyone help me out with the following, please?
The javascript for what I am wanting to do is as follows: HTML Code:
function alert( header, message ) {
parent.applet.document.ChatClient.alert( header, message );
}
HTML Code:
<td> <form name=Warn> <B>Warn:</B> <select onchange="javascript:alert(this.options[selectedIndex].value);"> <option value="">--------</option> <option value="Hi _USER_!";"Is everything ok?">Hi there!</option> </select> </form> </td> ![]() Thank you in advance.
|
|
#2
|
||||
|
||||
|
OK - the way I have done this (implemented for vBWar
) is as follows:You need an multi-dimensional array in a single array that javascript can manage... Try: Code:
$boofosarray[$header.":".$message] = $displayvalue; Should work So instead of putting your javascript call right there in the onchange, try putting a function call in there Code:
onchange="return gimmesomesugar(this.options[selectedIndex].value);" Code:
<script type="text/javascript">
<!--
function gimmesomesugar(sugar)
{
var somesugar = sugar.split(":");
parent.applet.document.ChatClient.alert( somesugar[0], somesugar[1] );
}
//-->
</script>
prolly better off in the <head>Let me know how u go pal ![]() [FYI: never name your custom javascript functions with the name of a default js function like "alert" ]
|
|
#3
|
||||
|
||||
|
Quote:
The drop down was my idea as I wanted to be able to click it and have it send a warning to the user. There's no way to do that with this?
|
|
#4
|
||||
|
||||
|
In your HTML page, can you add any content? like a Javascript function ?
|
|
#5
|
||||
|
||||
|
Quote:
HTML Code:
<td> <form name=Warn> <B>Warn:</B> <select onchange="javascript:alert(this.options[selectedIndex].value);"> <option value="">--------</option> <option value="Hi _USER_!";"Is everything ok?">Hi there!</option> </select> </form> </td> HTML Code:
<td> <form name="warn"> <B>Warn:</B> <select onchange="gimmesomesugar(this.options[selectedIndex].value);"> <option value="">--------</option> <option value="Hi _USER_!:Is everything ok?">Hi there!</option> </select> </form> </td> HTML Code:
<script type="text/javascript"> <!-- function gimmesomesugar(sugar) { var somesugar = sugar.split(":"); alert( somesugar[0], somesugar[1] ); } //--> </script>
|
|
#6
|
||||
|
||||
|
ok, that works, but it throws a popup up for this line:
-------- when I take it back to the beginning of the list. Can we fix that so it doesn't do anything for the first option like that? |
|
#7
|
||||
|
||||
|
Yeah - give it a value in your SELECT and test for that value in the javascript before throwing to the alter...
Try this HTML Code:
<script type="text/javascript"> <!-- function gimmesomesugar(sugar) { var somesugar = sugar.split(":"); if(somesugar.length==1) { return false; } alert( somesugar[0], somesugar[1] ); } //--> </script> |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|