How to Select Radio Button in javascript Via?

Hi Below code radio button selection sample script.
<script language=”javascript” type=”text/javascript”>
// For Radion Button Selected option

document.getElementById(‘sample’).checked = true;
if(document.getElementById(‘sample’).checked == true){
document.getElementById(‘sample’).style.display = ‘block’;
document.getElementById(‘sample’).disabled = false;
document.getElementById(‘sample’).disabled = false;
document.getElementById(‘sample’).disabled = false;
document.getElementById(‘sample’).disabled = false;
document.getElementById(‘sample’).disabled = false;
}
</script>

the above code is useful for yours more place. Enjoy its for very useful sometime in dynamic javascript section also. This is one of the small Javascript Via Radio Button Selection Sample.

How to Select Option Value in javascript Via?

Hi Below Code useful for yours Enjoy.
<script language=”javascript” type=”text/javascript”>
// For Option Value Selected in javascript Via

var myselect=document.getElementById(“myList”)
for (var i=0; i<myselect.options.length; i++){
myselect.options[i].selected=false;
//alert(“Selected Option’s index: “+i);
/* if (myselect.options[i].selected==true){
alert(“Selected Option’s index: “+i)
break
}*/
}
myselect.options[1].selected=true;
</script>

this is one of my method in javascript via options selection.

How to View Single Product URL Product ID via in Magento?

Hi below code for single product url. When you pass the query string in your url. You can use below code for single product url. Or you can put product id also here working fine.
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper(‘catalog/output’);

//Jai Write Below Code for Product id via getting Product URL Start

//redirect to old Product
if(isset($_GET[‘product_id’])){
$product_id = $_GET[‘product_id’];

$cProduct = Mage::getModel(“catalog/product”);
$cProduct->load($product_id);
//echo $cProduct->getImageUrl().”<br />”;
$currentProductURL = $cProduct->getProductUrl();
//echo $currentProductURL.”<br />”;

echo “<script type=’text/javascript’ language=’javascript’>window. location='”.$currentProductURL.”‘;</script>”;

}
//Jai Write Below Code for Product id via getting Product URL Start
?>

I have small knowledge in magento. So, I more then 3 hours spent for this code getting. If anyone find this post. This is useful for you.

thanks.

Simple coment hide script for WordPress Site?

<script type=”text/javascript” language=”javascript”>

//alert(document.getElementById(‘comments’));

var comLength = document.getElementById(“comments”).innerHTML;

/*alert(comLength);

alert(comLength.length);*/

if(comLength.length == “0”){

//alert(‘test’);

document.write(‘<style type=”text/css”>#comments{display:none;}</style>’);

}

else{

document.write(‘<style type=”text/css”>#comments{display:block;}</style>’);

//alert(“Test Else”+comLength.length);

}

</script>

How to read Current Browser URL via javascript?

<script language=”javascript” type=”text/javascript”>

function DinkyToy()
{
var pageURL = document.location.href;
var MyArray = pageURL.split(“?”)  ;
var BaseURL = MyArray[0];
var MyLangArray = pageURL.split(“/”);
var LangURL = MyLangArray[3];
/* Any variables would be appended */
/* using the ? and would appear in */
/* MyArray[1] */

//alert(‘pageURL = ‘ + pageURL)
//alert(‘BaseURL = ‘ + BaseURL)
alert(‘LangURL = ‘ + LangURL)

}
window.onload = DinkyToy();
</script>

How get String length in javascript Via?

You can below script from your side. If your application have any global value. you can use the string part that also working well.

Example :

global_value = 100.

<script type=”text/javascript” language=”javascript”>
var global = global_value;
(OR)
var string = “Test”;

if(global.length==’0′){
alert(global+’No Value’);
}
else{
alert(global+’  Value’);
}
</script>

Here how you want you can use. Which condition or just display string length. You can use your own idea.

How to Retrieving css values via javascript?

Hi this is one of good solution from my side, If anybody find new solution give me & Introduce people.

<div id=”hideProperty” style=”display:none”>
Test Hide Script getting value in javascript via.
</div>

<script type=”text/javascript” language=”javascript”>

var GLOBAL_Hide = “none”;
//alert(GLOBAL_Hide);

var hideProperty = document.getElementById(‘hideProperty’).style.display;

if(hideProperty == GLOBAL_Hide){
alert(hideProperty);
}
else {
document.write(‘<style type=”text/css”>#hideProperty{display: block; }</style>’);
}
</script>

Here what you want? you can write above script inside. that is your knowledge.

© 2020 Spirituality