Home / Web service / Web Program / The image changes depending on JavaScript url
JavaScript

The image changes depending on JavaScript url

How to change the image using javascript.

Certain categories at the mall when the solution is a different way of thinking trouble to mark the appropriate category.

For the most part, shopping solution to mark a category consists of a single page.

If I'm the one page should look different when you create a variety of categories used this time.

 

In the case of a shopping mall I am working with a great number of Category I were working at the request of a client that requests it possible to confirm the selected category when you select a specific category.

 

First look at the url of the shopping mall http://domain/front/php/category.php?cate_no=4 부터 시작 해서 cate_no=600 이 넘게 있었습니다.

 

It was decided what action you first find out when the corresponding cate_no = cate_no =.

 

How to come out the url in javascript

 

frmUrl = location.href

varCut = frmUrl.indexOf(“?”)
varCheck = frmUrl.substring(varCut + 1)
was varList = varCheck.split(“&”)
forCount = varList.length
for(i=0; i < forCount; i++)
{
eval(varList[i])

}

 

I used to.

 

If after this url right you'd need to change the image of the action. That part is as follows:.

 

window.onload = function ()
{
var IOC = cate_no;
var = pno ioc;

if(ioc = pno) {
document.getElementById(pno +”_or”).style.display = “none”;
document.getElementById(pno +”_ov”).style.display = “block”;

}
}

 

This gives the script is now working part-category images indeyo

<div id=”menu”>

<a href=”/front/php/category.php?cate_no=4″><img id=”4_or” src=”/web / upload / nfn / wendyrose / menu / w_menu_out_03.jpg” border=”0″ onMouseOver=”this.src = '/ web / upload / nfn / wendyrose / menu / w_menu_over_03.jpg'” onmouseout =”this.src = '/ web / upload / nfn / wendyrose / menu / w_menu_out_03.jpg'”><img id=”4_ov” style=”display:none” src=”/web / upload / nfn / wendyrose / menu / w_menu_over_03.jpg” border=”0″></div>

 

<div id=”menu”><a href=”/front/php/category.php?cate_no=5″><img id=”5_or” src=”/web / upload / nfn / wendyrose / menu / w_menu_out_03.jpg” border=”0″ onMouseOver=”this.src = '/ web / upload / nfn / wendyrose / menu / w_menu_over_03.jpg'” onmouseout =”this.src = '/ web / upload / nfn / wendyrose / menu / w_menu_out_03.jpg'”><img id=”5_ov” style=”display:none” src=”/web / upload / nfn / wendyrose / menu / w_menu_over_03.jpg” border=”0″></div>

 

 

This worked.

 

In JavaScript hayeotguyo specify cate_no of the url to ico, and have specified the same as the pnc cate_no.

And the image is put on the part of the two images shown Normally, an image is output with the url cate_no_ou ID that has cate_no to print images with cate_no_ov ID. ^^

 

Above the source indeyo how to mark images in each category Cafe 24 Store Solutions. If you use a script to figure out a url source as possible enough to use in other stores or website.

 

Until now, each appropriate category neundeyo incredibly many sources to create a simple Java seukeuripreul I think it is not there a way to simplify it helped solve a few lines .. ^^

Try it you too .. ^^

Check Also

phpmyadmin 404

nginx phpmyadmin 404 Not Found

Suddenly in phpmyadmin nginx server 404 Not Found 오류 가 발생 한다면 그 동안 서버에

Leave a Reply

Your email address will not be published. Required fields are marked *