Hyper Link inside html select control - asp.net

I have a html select control. I want to have a item which is a link to navigate to some other page, when it is selected with out postbacking.
Thanks in advance

How about this ?
<select onchange="location=this.options [this.selectedIndex].value;">
<option>- Select -</option>
<option value="http://www.google.com" >Google</option>
<option value="http://www.facebook.com" >Facebook</option>
<option value="http://www.stackoverflow.com" >Stackoverflow</option>
</select>

Related

How can i add a Select Option in AMP

I have a page with a Select Option
but in my AMP Page i cant see this element,
What i need to add to this work?
For navigate the page use AMP.navigateTo
<select on="change:AMP.navigateTo(url=event.value)">
<option selected>-Select a Page-</option>
<option value="YOUR-PAGE-URL">Home Page</option>
<option value="YOUR-PAGE-URL">About Us</option>
<option value="YOUR-PAGE-URL">Camping Tips</option>
</select>

How to set drop down display none when any specific option selected using CSS

I am using a asp.net screen to enter the data as we as I also want to use same screen as red-only mode to view only for some users.
I have drop down in my screen that default selected index is 0 and text is 'Please Select' these drop downs are not mandatory so in edit mode user may not select any value for drop downs so default value would be 'Please Select' but when user open a same screen in read-only mode to view the saved data I want to hide those drop-down which are having default value as 'Please Select' but by using CSS. I have an option using jquery but I am looking a way by using css if it is possible. I have two css file that I am changing dynamically for read-only mode and edit mode.
I got some css as follows, in same way I am looking solution for my issue.
<!DOCTYPE html>
<html>
<head>
<style>
select [value=two][selected=selected] {
display:none
visibility:hidden;
}
</style>
</head>
<body>
<th>Show This Drop down</th>
<select id="ddlNumber">
<option value="-1">Please Select</option>
<option value="one">one</option>
<option value="two" selected="selected">two</option>
<option value="three">three</option>
<option value="four">four</option>
</select>
<br>
<br>
<th>Hide This Drop down by css</th>
<select id="ddlAlpha">
<option value="-1" selected="selected">Please Select</option>
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
<option value="4">D</option>
</select>
</body>
</html>

how can I open an image in lightbox from a list of dropdown options after clicking the submit button

I have been searching the web for a result all day to solve my question...
I want a list of options, that would each link to a different image. However, instead of the image opening in a new window, I want the image to open in a lightbox on the same page (lightbox evolution for wordpress is the plugin I am using).
I have tried using onclick in input field, and the lightbox will open (if class="lightbox") but no image loads.
I don't know if I need to add a function that will allow the input to recognize which option is selected so that when the input button is clicked, that that specific image opens in a lightbox.
And if I do need a function, I don't know where to add the function... onclick? Somewhere in the option tag, or select tag?
<form>
<select>
<option value="linkimage1.jpg">image 1</option>
<option value="linkimage2.jpg">image 2</option>
<option value="linkimage3.jpg">image 3</option>
<input type="button" value="submit" />
</select>
</form>
Any help would be appreciated, even if it's to a good link that could explain how I could create a function and add it to my code, and then use a solution to call the function into my dropdown.
Thanks
If using iLightBox http://ilightbox.net/ you can do that like this:
<select id="selectImage">
<option>Select Image</option>
<option value="linkimage1.jpg">image 1</option>
<option value="linkimage2.jpg">image 2</option>
<option value="linkimage3.jpg">image 3</option>
</select>
<script>
jQuery(document).ready(function($){
$('select#selectImage').change(function(){
var $this = $(this),
url = $this.val();
$.iLightBox(url);
});
});
</script>

Dropdown is not showed completelly the first time the page showed

I have a dropdownlist declared like this:
<select id="PageToCreate_AuthorID">
<option value="">Please select...</option>
<option value="1">Thierry</option>
<option value="2">Vanessa</option>
</select>
When the page is showed the fist time, here is what is displayed:
As you can see, we don't see all the text inside the control.
Then I click inside it and the dropdown is adjusted:
How can I do to have the dropdown showed correctly when the page is showed the first time?
Thanks.
Try to add some css for your select tag :
<select id="PageToCreate_AuthorID">
<option value="">Please select...</option>
<option value="1">Thierry</option>
<option value="2">Vanessa</option>
</select>
Css:
#PageToCreate_AuthorID {
min-width:200px; /* Change this value if you think you must do it */
}

Functions php, make drop down list work

In functions php, this works like a charm:
<textarea name="menu1anchor" id="menu1anchor" cols="40" rows="1"><?php echo get_option('menu1anchor'); ?></textarea>
How can i make this drop down list work? I want to be able to input my values and select a desired one later on.
Right now, it does not matter which value I select, after i press "save changes" it does not send my value thru the form to wordpress options.
<select name="menu1" id="menu1">
<option value="1">Microsoft</option>
<option value="2">Google</option>
<option value="3">Apple</option>
</select>
Thank u!
<select name="menu1" id="menu1">
<option value="1"<?php selected(get_option('menu1'),1); ?>>Microsoft</option>
<option value="2"<?php selected(get_option('menu1'),2); ?>>Google</option>
<option value="3"<?php selected(get_option('menu1'),3); ?>>Apple</option>
</select>
Try that instead.

Resources