 |
jQuery ผมต้อง การจะเรียกพารามิเตอ a[rel='tab'] จากจาวาสคลิปอ่าคับ |
|
 |
|
|
 |
 |
|
คือผมกำลังทำเว็บอยู่ และสคลิปชุดนี้ทำงานโดยการจะไม่โหลดข้อมูลในส่วน header ขึ้นมาใหม่ แต่ต้องทำงานผ่าน พารามิเตอนี้คับ a[rel='tab'] แต่เมนูผมเป็นจาวาสคลิปใช้โค๊ดแบบข้างล่างนี้ครับ ไม่รู้จริงๆว่าจะแต่งยังไงให้มันเข้ากัน
Symbol.bindElementAction(compId, symbolName, "${_F}", "click", function(sym, e) {
// Navigate to a new URL in the current window
// (replace "_self" with appropriate target attribute for a new window)
window.open("menu1.php", "_self");
ตัวนี้เป็นโค็ดเพื่อไม่ให้โหลดซ้ำนะครับ ซึ่งต้องการจะให้โด๊ด้ขางบนใช้งานกับโค๊ดข้างล่างนี้ได้
<script>
$(function(){
$("a[rel='tab']").click(function(e){
//e.preventDefault();
/*
if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
if commented, html5 nonsupported browers will reload the page to the specified link.
*/
//get the link location that was clicked
pageurl = $(this).attr('href');
//to get the ajax content and display in div with id 'content'
$.ajax({url:pageurl+'?rel=tab',success: function(data){
$('#content').html(data);
}});
//to change the browser URL to 'pageurl'
if(pageurl!=window.location){
window.history.pushState({path:pageurl},'',pageurl);
}
return false;
});
});
/* the below code is to override back button to get the ajax content without reload*/
$(window).bind('popstate', function() {
$.ajax({url:location.pathname+'?rel=tab',success: function(data){
$('#content').html(data);
}});
});
</script>
Tag : Java, HTML/CSS, jQuery, JAVA
|
|
 |
 |
 |
 |
Date :
2013-08-08 09:14:14 |
By :
psnorth538 |
View :
834 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมถามยากไป ทำไม่ได้ หรือว่าไรอ่าคับ ไม่มีใครตอบผมเลย
|
 |
 |
 |
 |
Date :
2013-08-09 09:11:10 |
By :
psnorth538 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คนที่เข้าใจอาจจะยังไม่มาเจอ ผมยังงเลยคับอิอิ
|
 |
 |
 |
 |
Date :
2013-08-09 09:23:50 |
By :
Krungsri |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คุณลองอธิบายความต้องการคุณใหม่ หรือว่าบอกแค่ต้องการทำอะไร ยังไง บางทีอาจจะต้องเขียนแบบใหม่ถึงจะใช้งานได้ครับ
โค๊ดมันไม่ได้ยากอะไรมากมายหรอก แค่ยากที่จะเข้าใจคำถามคุณอะครับ 
|
 |
 |
 |
 |
Date :
2013-08-10 02:15:00 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2013-08-10 07:13:40 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|