저는 4 세에 매우 익숙하며 또 다른보기로 내 레이아웃을 확장하려고합니다.Laravel 4 개의 다른 페이지들 @section은 스크립트를 깨고 있습니다.
내 layout.blade.php의 끝이 있습니다
{{ HTML::script('js/jquery.nicescroll.min.js') }}
{{ HTML::script('js/jquery.pickmeup.min.js') }}
{{ HTML::script('js/myscript.js') }}
</body>
</html>
다음
난 그냥 보여주기 위해, 내가 아주 많이 보유하고있는 파일 page1.blade.php이 필수 :이 파일에서
@extends('layout/layout')
@section('contents')
<section id="start">
......
</section>
@stop
는 myscript.js에서 모든 자바 스크립트 기능을 연구하다 아무 문제없이 unning, 그들은 단지 layout.blade.php에 포함되어 있지만
지금은 해당 파일 'bookings.blade.php'다음은에 '예약'라는 또 다른 뷰를 생성
bookings.blade.php : 기본적으로
@extends('layout/layout')
@section('contents')
<section id="bookingform">
<div id="bookingforma" style="background-color: #00a651; height: 10px; width:100%;">
{{ Form::open(array('url' => 'bookings', 'class' => 'form-inline', 'role' => 'form')) }}
<div class="form-group">
<span><strong>Date available? </strong> </span>
{{ Form::text('from1',Input::get('from'),array('class' => 'form-control', 'id' => 'fromforma')) }}
</div> <span><strong> - </strong></span>
<div class="form-group">
{{ Form::text('to1',Input::get('to'),array('class' => 'form-control', 'id' => 'toforma')) }}
</div> <span><strong> for </strong></span>
<div class="checkbox">
{{ Form::select('persons1', array('1' => '1','2'=>'2','3'=>'3','4'=>'4'),Input::get('persons'),array('class' => 'form-control')) }}
</div>
{{ Form::submit('Request!', array('class' => 'btn btn-success')) }}
{{ Form::close() }}
</div>
</section>
@stop
내가 page1.blade.php에 정확히 @section과 @stop 및 @extends과 같은 일을 해요는, 는하지만이 중 하나를 사용할 수 없습니다 자바 스크립트 함수. 나는
var a = document.getElementById('bookingform');
withing에의 myscript.js의 page1.blade.php의 내용에 대한 자바 스크립트 휴식을 호출하는 경우
도, 정확합니다.Route::get('/', function()
{
return View::make('page1');
});
Route::get('index', function() {
return View::make('page1');
});
Route::get('bookings', '[email protected]');
Route::post('bookings','[email protected]');
을 그리고 BookingController :
class BookingController extends BaseController {
public function getBooking(){
return View::make('bookings');
}
public function getBookingDates()
{
$data = Input::all();
return View::make('bookings');
}
}
이 있습니까
내 routes.php 파일은 다음과 같다 (그리고 bookings.blade.php 작동하지 않습니다) 내가 완전히 laravel에 대해 얻지 못하는 것 또는 누군가가 문제를 보는가?
편집 :
자바 스크립트 : 사용자가 추가 결코처럼
$(document).ready(function() {
function heightsetter() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
y = w.innerHeight || e.clientHeight || g.clientHeight;
return y;
}
var resizeTimeout;
window.onresize = function() {
clearTimeout(resizeTimeout);
var height = document.getElementById('start');
height.style.height = heightsetter() + "px";
var heightz = document.getElementById('hotels');
heightz.style.height = heightsetter() + "px";
var heightd = document.getElementById('training');
heightd.style.height = heightsetter() + "px";
resizeTimeout = setTimeout(function() {
}, 250);
};
var height = document.getElementById('start');
height.style.height = heightsetter() + "px";
var heightz = document.getElementById('hotels');
heightz.style.height = heightsetter() + "px";
var heightd = document.getElementById('training');
heightd.style.height = heightsetter() + "px";
var heightb = document.getElementById('bookingform'); //<<< **this breaks it**
heightb.style.height = heightsetter() + "px";
.....
});
DOM 준비가 완료 될 때까지'var a = document.getElementById ('bookingform');을 연기합니까? 콘솔에 오류가 있습니까? –
$ (document) .ready (function(), yes.) 콘솔에서받는 오류는 Uncaught입니다. TypeError : page1 (일반적으로 작동하는) 및 예약에서 null 속성의 'style'을 읽을 수 없습니다. 나는 : Uncaught TypeError : null의 속성 'style'을 읽을 수 없다. @BenHarold – baao
자바 스크립트가 작동하지 않는 이유가 그 것이다. 자바 스크립트 코드를 추가 할 수 있습니까?이 오류는 btw가 존재하지 않는 요소를 참조 함을 의미합니다. –